<?php namespace Summer\Hjd\Models;

use Model;

/**
 * Model
 */
class BonusTypeModel extends Model
{
    use \Winter\Storm\Database\Traits\Validation;
    

    /**
     * @var string The database table used by the model.
     */
    public $table = 'summer_hjd_bonus_type';

    /**
     * @var array Validation rules
     */
    public $rules = [
        'slug' => 'required|between:2,255|unique:summer_hjd_bonus_type',
        'title' => 'required|between:2,255',
        'change_slug' => 'required',
        'allot' => 'required',
    ];
    protected $jsonable = [
        'allot'
    ];
    public $hasOne = [
        'change' => ['Summer\Hjd\Models\ChangeModel', 'key' => 'slug', 'otherKey' => 'change_slug']
    ];
    public function getChangeSlugOptions()
    {
        return ChangeModel::where('status',1)->pluck('title','slug');
    }
    public function getAllotCurrencyOptions()
    {
       return CurrencyModel::where('status',1)->pluck('title','slug');
    }

    public function getFilterBonusTypeOptions()
    {
        return BonusTypeModel::lists('title', 'slug');
    }

}
